package com.shujia.control;

import com.shujia.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ValueControllerDemo {

    @Value("${MyName}")
    String MyName;

    @Value("${age}")
    String age;

    @RequestMapping("nameandage")
    public String getNameAndage(){
        return "MyName:"+MyName+" age:"+age;
    }

    @Value("${student.student_name}")
    String studentName;

    @Value("${student.age}")
    String studentAge;
    @Value("${student.gender}")
    String studentGender;

    @Value("${student.clazz}")
    String studentClazz;

    @RequestMapping("student")
    public String getStudent(){
        return "MyName:"+studentName+" age:"+studentAge+"studentGender:"+studentGender+"studentClazz:"+studentClazz;
    }

    @Autowired
    Student student;

    @RequestMapping("studentObj")
    public String getStudentObj(){
        return student.toString();
    }

}
